const globalContextWebSocket = new WebSocket("ws://localhost:8081/globalContext/ws");

const globalContextWS = {
    onopen(cb) {
        globalContextWebSocket.onopen = evt => {
            console.log("Connection open for synchronize Context");
            globalContextWebSocket.send("synchronize");
            cb(evt.data);
        };
    },

    onmessage(cb) {
        globalContextWebSocket.onmessage = evt => {
            cb(evt.data);
        };
    },

    send(data) {
        globalContextWebSocket.send(data)
    }

}
